Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom project root setting #5769

Merged
merged 1 commit into from
Oct 25, 2023
Merged

Conversation

kasiaMarek
Copy link
Contributor

No description provided.

}
): Option[AbsolutePath] = {
customProjectRoot match {
case Some(projectRoot) => Some(projectRoot).filter(isProjectRoot)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case Some(projectRoot) => Some(projectRoot).filter(isProjectRoot)
case Some(projectRoot) if isProjectRoot(projectRoot) => Some(projectRoot)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on purpose like this. So if you choose a custom root it should look only in that root. We had a problem discussed on discord, where a person had a custom bsp and an unused sbt somewhere lower file hierarchy.

userConfig().customProjectRoot
.map(_.trim() match {
case "." => workspace
case relativePath => workspace.resolve(relativePath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure, if customProjectRoot is empty (Some("")) it resolves to workspace here and works as if it was None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty is filtered out while fromJson on the whole UserConfig.

Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just two minor comments

Comment on lines 127 to 128
case "." => workspace
case relativePath => workspace.resolve(relativePath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

workspace.resolve(".") will amount to the same

Suggested change
case "." => workspace
case relativePath => workspace.resolve(relativePath)
case relativePath => workspace.resolve(relativePath)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure about Windows.

"custom-project-root",
"""empty string `""`.""",
""""backend/scalaProject/"""",
"Scala CLI launcher",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Scala CLI launcher",
"Custom project root",

@kasiaMarek kasiaMarek merged commit dabe36c into scalameta:main Oct 25, 2023
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants